Decorated Attribute Grammars: Attribute Evaluation Meets Strategic Programming
نویسندگان
چکیده
Attribute grammars are a powerful specification formalism for treebased computation, particularly for software language processing. Various extensions have been proposed to abstract over common patterns in attribute grammar specifications. These include various forms of copy rules to support non-local dependencies, collection attributes, and expressing dependencies that are evaluated to a fixed point. Rather than implementing extensions natively in an attribute evaluator, we propose attribute decorators that describe an abstract evaluation mechanism for attributes, making it possible to provide such extensions as part of a library of decorators. Inspired by strategic programming, decorators are specified using generic traversal operators. To demonstrate their effectiveness, we describe how to employ decorators in name, type, and flow analysis.
منابع مشابه
Attribute Evaluation Meets Strategic Programming
Attribute grammars are a powerful specification formalism for tree-based computation, particularly for software language processing. Various extensions have been proposed to abstract over common patterns in attribute grammar specifications. These include various forms of copy rules to support non-local dependencies, collection attributes, and expressing dependencies that are evaluated to a fixe...
متن کاملSSCC: A Software Tool Based on Extended Ordered Attribute Grammars
Attribute grammars are a formalism for specifying computations on syntax trees. SSCC (a Sufficiently Smart Compiler Compiler) is a practical attribute-grammar system based on a polynomial-time extension to Kastens’s ordered attribute grammars. The new class of attribute grammars is strictly larger than the class of ordered attribute grammars, and it retains the property that there is a polynomi...
متن کاملUsing logical formulas to improve the expressiveness of Relational Attribute Grammars
Considering the theory of attribute grammars, we use logical formulas instead of traditional functional semantic rules. Following the decoration of a derivation tree, a suitable algorithm should maintain the consistency of the formulas together with the evaluation of the attributes. This may be a Prolog-like resolution, but this paper examines a somewhat different strategy, based on production ...
متن کاملSSCC: A Sufficiently Smart Compiler-Compiler
Attribute grammars are a formalism for specifying computations on syntax trees. SSCC is a practical attribute-grammar system based on a polynomial-time extension of Kastens’s ordered attribute grammars. The system comprises of two subsystems. The generation subsystem computes the evaluation order of attribute occurrences in production rules and translates attribute equations into low-level code...
متن کاملZipper-based Embedding of Modern Attribute Grammar Extensions
This research abstract describes the research plan for a Ph.D project. We plan to define a powerful and elegant embedding of modern extensions to attribute grammars. Attribute grammars are a suitable formalism to express complex, multiple traversal algorithms. In recent years there has been a lot of work in attribute grammars, namely by defining new extensions to the formalism (forwarding and r...
متن کامل